<?php

namespace App\Jobs;

use App\Repository\UserRepository;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class SaveUserPhone implements ShouldQueue
{
    use InteractsWithQueue, Queueable, SerializesModels;
    /**
     * @var
     */
    private $openId;
    private $shortPhone;
    private $cellphone;

    /**
     * Create a new job instance.
     *
     * @param $openId
     * @param $shortPhone
     * @param $cellphone
     */
    public function __construct($openId, $shortPhone, $cellphone)
    {
        $this->openId = $openId;
        $this->shortPhone = $shortPhone;
        $this->cellphone = $cellphone;
    }

    /**
     * Execute the job.
     *
     * @param UserRepository $user
     */
    public function handle(UserRepository $user)
    {
        $user->updateUserPhone($this->openId, $this->shortPhone, $this->cellphone);
    }
}
